Skip to content

🐛 Fix ELB classic load balancer field alignment and filtering#6679

Merged
chris-rock merged 2 commits intomondoohq:mainfrom
LittleSalkin1806:align-aws-loadbalancer-v1-v2
Feb 26, 2026
Merged

🐛 Fix ELB classic load balancer field alignment and filtering#6679
chris-rock merged 2 commits intomondoohq:mainfrom
LittleSalkin1806:align-aws-loadbalancer-v1-v2

Conversation

@LittleSalkin1806
Copy link
Copy Markdown
Contributor

Summary

This PR fixes several issues with classic (v1) ELB load balancers so they work the same way as v2 (ALB/NLB) load balancers.

What was wrong

  • Missing fields on classic LBs: Querying availabilityZones, securityGroups, hostedZoneId, or vpc on a classic load balancer would fail with a type conversion error because those fields were never set during creation.
  • Duplicate results: Every load balancer (classic and v2) appeared twice in query results due to being appended to the list before and after the tag filter check.
  • Crashes with tag filters: When using --filters "tag:...", looking up security groups or VPCs could fail if those resources didn't match the tag filter, breaking the entire query.
  • Unnecessary API calls: The targetGroups field on classic LBs tried to call the v2 API, which doesn't recognize classic ARNs. Now it returns an empty list immediately.
  • Init function called for wrong resources: The ELB init function was being triggered for non-ELB resources (like S3 buckets or IAM users), wasting API calls. Now it exits early if the ARN isn't an ELB.
  • Discovery region: The discovery code was parsing the region from the ARN instead of using the field already on the resource.

Changes

  • aws_elb.go: Added missing fields to classic LBs, removed duplicate appends, made SG/VPC resolution graceful, added early exit for non-ELB ARNs in init, added classic LB guard on targetGroups.
  • discovery.go: Simplified region handling to use f.Region.Data directly.

Copy link
Copy Markdown

@mondoo-code-review mondoo-code-review bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix for ELB field alignment and filtering issues

@LittleSalkin1806 LittleSalkin1806 force-pushed the align-aws-loadbalancer-v1-v2 branch from 9568dc7 to 656b100 Compare February 25, 2026 13:13
@LittleSalkin1806 LittleSalkin1806 force-pushed the align-aws-loadbalancer-v1-v2 branch from 656b100 to 5727dc4 Compare February 25, 2026 13:15
@tas50 tas50 changed the title Fix ELB classic load balancer field alignment and filtering 🐛 Fix ELB classic load balancer field alignment and filtering Feb 25, 2026
Copy link
Copy Markdown
Member

@chris-rock chris-rock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @LittleSalkin1806

@chris-rock chris-rock merged commit 1f8723e into mondoohq:main Feb 26, 2026
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants